<template>
	<view>
		<u-toast ref="uToast" />
		<view class="relocation-content empty">
			<view class="relo-header">
				<uni-forms ref="form" :modelValue="params" :label-width="50">
					<uni-forms-item label="站台名称" label-align="right" :label-width="70">
						<uni-data-select v-model="params.stationNo" :localdata="stnRange"
							placeholder="请选择需求空容器的站台"></uni-data-select>
					</uni-forms-item>
					<uni-forms-item label="需求数量" name="planQty" :label-width="70">
						<uni-easyinput v-model="params.planQty" type="number" maxlength="2"
							placeholder="请输入需求数量"></uni-easyinput>
					</uni-forms-item>
				</uni-forms>
			</view>
		</view>
		<button class="next" type="primary" @click="outConfirm">确认呼叫</button>
	</view>
</template>
</script>
<script>
	import {
		emptyCall
	} from '@/api/request.js'
	export default {
		name: 'rf-form',
		data() {
			return {
				params: {
					contType: '',
					stationNo: '',
					planQty: '1'
				},
				stnRange: [{
						value: '1F_OUT_ST11',
						text: "料箱出库区"
					},
					{
						value: '1F_OUT_ST12',
						text: "托盘出库区"
					}
				],
			};
		},
		methods: {
			_inputFocus() {
				document.querySelector('#inputSelect input').select()
			},
			outConfirm() {
				if (!this.params.stationNo) {
					uni.showModal({
						title: '失败提示',
						confirmColor:'#F54E40',
						showCancel: false,
						content: '请选择需要空容器的区域站台！',
					})
					return
				}

				emptyCall(this.params, (res) => {
					console.log(res);
					if (res.code == 0) {
						uni.showModal({
							title: '成功信息',
							confirmColor:'#00ff00',
							showCancel: false,
							content: res.data,
						})
					} else {
						uni.showModal({
							title: '失败提示',
							confirmColor:'#F54E40',
							showCancel: false,
							content: res.msg,
						})
					}

				})
			}
		}
	}
</script>

<style lang="scss">
	@import url("@/static/styles/form.scss");
</style>
<style scoped>
	::v-deep .is-disabled {
		color: black;
	}

	.relocation-content .relo-header {
		padding-bottom: 0;
	}

	.unit {
		margin-right: 5px;
	}

	.empty .uni-forms {
		overflow: visible;
	}
</style>